#ifndef EFFTESTNODE_H
#define EFFTESTNODE_H
#include "cocos2d.h"
USING_NS_CC;

#include "EffectSprite.h"

class EffTestNode : public CCNode
{
public:
	CREATE_FUNC(EffTestNode)
public:
	bool init()
	{
		bool bRet = false;
		do {
			const CCSize winSize = CCDirector::sharedDirector()->getWinSize();
			EffectSprite* e = EffectSprite::create("bg.png",
			                                       EffectSprite::EFF_LIGHTER);
			e->setAnchorPoint(ccp(0, 1));
			e->setPosition(ccp(0, winSize.height));
			e->setScale(0.5);
			addChild(e, 0, 1);

			e = EffectSprite::create("bg.png",
			                         EffectSprite::EFF_GREY);
			e->setAnchorPoint(ccp(1, 0));
			e->setPosition(ccp(winSize.width , 0));
			e->setScale(0.5);
			addChild(e, 0, 2);


			this->schedule(schedule_selector(EffTestNode::changeEff), 0.1);
			bRet = true;
		}while(0);
		return bRet;
	}
private:
	float vvv = 0.1f;
	void changeEff(float dt)
	{
		EffectSprite* e = (EffectSprite*)this->getChildByTag(1);
		if (e->_data <= 0) {
			vvv = 0.1f;
		} else if (e->_data >= 1.0f) {
			vvv = -0.1f;
		}
		e->_data += vvv;
	}
};


#endif // EFFTESTNODE_H

